package values.buff
{
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;

import values.events.BuffValueEvent;

[Event(name="buffEnd", type="values.events.BuffValueEvent")]
/**
 * BuffValue
 * @author jliang
 *
 */
public class BuffValue extends EventDispatcher
{
	protected var _name:String;

	public function get name():String
	{
		return _name;
	}

	public function set name(value:String):void
	{
		_name = value;
	}
	
	protected var _desc:String;

	public function get desc():String
	{
		return _desc;
	}

	public function set desc(value:String):void
	{
		_desc = value;
	}
	
	protected var _icon:String;

	public function get icon():String
	{
		return _icon;
	}

	public function set icon(value:String):void
	{
		_icon = value;
	}
	
	protected var _time:int;	

	public function get time():int
	{
		return _time;
	}

	public function set time(value:int):void
	{
		_time = value;
		
		restTime = time;
	}
	
	protected var _restTime:int;

	public function get restTime():int
	{
		return _restTime;
	}

	public function set restTime(value:int):void
	{
		_restTime = value;
		
		if (time > 0 && restTime <= 0)
		{
			var evt:BuffValueEvent = new BuffValueEvent(BuffValueEvent.BUFF_END);
			evt.params = { buff:this };
			this.dispatchEvent(evt);
		}
	}
	
	protected var _target:int;

	public function get target():int
	{
		return _target;
	}

	public function set target(value:int):void
	{
		_target = value;
	}
	
	protected var _type:int;

	public function get type():int
	{
		return _type;
	}

	public function set type(value:int):void
	{
		_type = value;
	}
	
	public var params:*;
}
}



